package cn.net.yugu.doraemon.netty.protocol.constant;

import java.util.HashMap;
import java.util.Map;

/**
 * @description:
 * @author: wanghongli
 * @create: 2023-03-10 14:37:26
 */
public interface ConstEnum {
    enum Flag {
        /**
         * 标记.
         */
        TRUE((byte) 1, "是"),
        FALSE((byte) 0, "否");

        private final byte value;
        private final String name;

        private static Map<Integer, String> map = new HashMap<Integer, String>();

        static {
            for (Flag s : Flag.values()) {
                map.put(s.getValue(), s.getName());
            }
        }

        Flag(byte value, String name) {
            this.value = value;
            this.name = name;
        }

        public String getName() {
            return name;
        }

        public int getValue() {
            return value;
        }

        public static String getName(int value) {
            return map.get(value);
        }
    }
}
